# eric7.DebugClients.Python.DebugUtilities

Module implementing utilities functions for the debug client.

### Global Attributes

ArgInfo
PYTHON_NAMES
mod_dict

### Classes

None

### Functions

_getfullargs | Protected function to get information about the arguments accepted by a code object.
formatargvalues | Function to format an argument spec from the 4 values returned by getargvalues.
getargvalues | Function to get information about arguments passed into a particular frame.
isExecutable | Function to check, if the given program is executable.
isPythonProgram | Function to check, if the given program is a Python interpreter or program.
isWindowsPlatform | Function to check, if this is a Windows platform.
patchArgumentStringWindows | Function to patch an argument string for Windows.
patchArguments | Function to patch the arguments given to start a program in order to execute it in our debugger.
prepareJsonCommand | Function to prepare a single command or response for transmission to the IDE.
quoteArgs | Function to quote the given list of arguments.
removeQuotesFromArgs | Function to remove quotes from the arguments list.
startsWithShebang | Function to check, if the given program start with a Shebang line.
stringToArgumentsWindows | Function to prepare a string of arguments for Windows platform.

## _getfullargs

_getfullargs(co)

Protected function to get information about the arguments accepted by a code object.

co (code)
  reference to a code object to be processed

Return:
  tuple of four things, where 'args' and 'kwonlyargs' are lists of argument names, and 'varargs' and 'varkw' are the names of the * and ** arguments or None.

Return Type:
  tuple of (list of str, list of str, list of str, list of str)

Raises TypeError:
  raised if the input parameter is not a code object

Up

## formatargvalues

formatargvalues(args, varargs, varkw, localsDict, formatarg=str, formatvarargs=lambda name: "*" + name, formatvarkw=lambda name: "**" + name, formatvalue=lambda value: "=" + repr(value), )

Function to format an argument spec from the 4 values returned by getargvalues.

args (list of str)
  list of argument names
varargs (str)
  name of the variable arguments
varkw (str)
  name of the keyword arguments
localsDict (dict)
  reference to the local variables dictionary
formatarg (func)
  argument formatting function
formatvarargs (func)
  variable arguments formatting function
formatvarkw (func)
  keyword arguments formatting function
formatvalue (func)
  value formating functtion

Return:
  formatted call signature

Return Type:
  str

Up

## getargvalues

getargvalues(frame)

Function to get information about arguments passed into a particular frame.

frame (frame)
  reference to a frame object to be processed

Return:
  tuple of four things, where 'args' is a list of the argument names, 'varargs' and 'varkw' are the names of the * and ** arguments or None and 'locals' is the locals dictionary of the given frame.

Return Type:
  ArgInfo

Raises TypeError:
  raised if the input parameter is not a frame object

Up

## isExecutable

isExecutable(program)

Function to check, if the given program is executable.

program (str)
  program path to be checked

Return:
  flag indicating an executable program

Return Type:
  bool

Up

## isPythonProgram

isPythonProgram(program, withPath=False)

Function to check, if the given program is a Python interpreter or program.

program (str)
  program to be checked
withPath (bool (optional))
  flag indicating to search the program in the executable search path (defaults to False)

Return:
  flag indicating a Python interpreter or program

Return Type:
  bool

Up

## isWindowsPlatform

isWindowsPlatform()

Function to check, if this is a Windows platform.

Return:
  flag indicating Windows platform

Return Type:
  bool

Up

## patchArgumentStringWindows

patchArgumentStringWindows(debugClient, argStr)

Function to patch an argument string for Windows.

debugClient (DebugClient)
  reference to the debug client object
argStr (str)
  argument string

Return:
  patched argument string

Return Type:
  str

Up

## patchArguments

patchArguments(debugClient, arguments, noRedirect=False, isPythonProg=False)

Function to patch the arguments given to start a program in order to execute it in our debugger.

debugClient (DebugClient)
  reference to the debug client object
arguments (list of str)
  list of program arguments
noRedirect (bool (optional))
  flag indicating to not redirect stdin and stdout (defaults to False)
isPythonProg (bool (optional))
  flag indicating a Python script (defaults to False)

Return:
  modified argument list

Return Type:
  list of str

Up

## prepareJsonCommand

prepareJsonCommand(method, params)

Function to prepare a single command or response for transmission to the IDE.

method (str)
  command or response name to be sent
params (dict)
  dictionary of named parameters for the command or response

Return:
  prepared JSON command or response string

Return Type:
  str

Up

## quoteArgs

quoteArgs(args)

Function to quote the given list of arguments.

args (list of str)
  list of arguments to be quoted

Return:
  list of quoted arguments

Return Type:
  list of str

Up

## removeQuotesFromArgs

removeQuotesFromArgs(args)

Function to remove quotes from the arguments list.

args (list of str)
  list of arguments

Return:
  list of unquoted strings

Return Type:
  list of str

Up

## startsWithShebang

startsWithShebang(program)

Function to check, if the given program start with a Shebang line.

program (str)
  program path to be checked

Return:
  flag indicating an existing and valid shebang line

Return Type:
  bool

Up

## stringToArgumentsWindows

stringToArgumentsWindows(args)

Function to prepare a string of arguments for Windows platform.

args (str)
  list of command arguments

Return:
  list of command arguments

Return Type:
  list of str

Raises RuntimeError:
  raised to indicate an illegal arguments parsing condition

Up